package io.renren.modules.yst.utils;

import org.joda.time.DateTime;
import org.joda.time.LocalDate;

import java.util.Date;

public class DateUtils {
    public static void main(String[] args) {
        DateUtils.getCurrentMonthFirstAndEnd();
    }
    /**
     * 根据当前日期，获取月开始日期、月结束日期
     * @return  返回date[0]开始日期、date[1]结束日期
     */
    public static Date[] getCurrentMonthFirstAndEnd(){
        DateTime dateTime = new DateTime();
        LocalDate date = new LocalDate(dateTime);

        LocalDate date1 = date.dayOfMonth().withMinimumValue();
        LocalDate date2 = date.dayOfMonth().withMaximumValue();

        Date beginDate = date1.toDate();
        Date endDate = date2.toDate();
        return new Date[]{beginDate, endDate};
        }
    }

